var PATH_PREFIX ="";

function setPathPrefix(path){
	PATH_PREFIX =  path;
}

$(function(){
	// 给select2组件加载样式
	WASP_WIDGET.initializeSelectStyle();
	//初始化单选框
	$('#reportType').select2({placeholder: "报告类型"});
	
	//select2改变值的时候要进行及时表单校验
	WASP_WIDGET.triggerPrdInfoSelect("prjCode");
	
	WASP_WIDGET.triggerDateStyleWithYMD("#reportTime");
});	

var ESTIMATE_UPLOAD = {
		/**
		 * 校验
		 */
		dynamicJqValidate: function(method) {
			INVEST_UPLOAD.removeRules();
			$("#reportType").rules("add", {
				required : true, messages:{required:"请选择报告类型"}
			});
		},
		/**
		 * 移除规则
		 */
		removeRules: function() {
			$("#reportType").rules("remove");
		},
	/**
	 * 保存文档信息
	 */
	submitForm: function() {
		SubmitAndPreventSecond("estimateForm",function(){
			$("#prjCode").removeAttr("disabled");
			$("#reportTime").removeAttr("disabled");
			//获取附件ID
			$('#attIds').val(serialAttId("attachContainerinvest"));
			
			var url = PATH_PREFIX + "saveEstimateInfo.do";
			$("#estimateForm").attr("action",url);
		});
	}
};
